// sysModelView.js
const Base = require('../base.js');
// https://testjoylearning.bmw.com.cn:8080/sys/storeApprove/list?pageNo=1&pageSize=10
module.exports = function(sequelize, DataTypes) {
    function getAttributes(sequelize, DataTypes) {
        const attributes = {
            modelId: {
                field: "model_view_id",
                type: DataTypes.BIGINT(20),
                primaryKey: true,
                comment: "实体视图ID"
            },
            modelCode: {
                field: "model_code",
                type: DataTypes.STRING(50),
                allowNull: false,
                comment: "模型编码"
            },
            language: {
                field: "language",
                type: DataTypes.STRING(50),
                allowNull: false,
                comment: "语言"
            },
            queryKey: {
                field: "query_key",
                type: DataTypes.STRING(50),
                allowNull: false,
                comment: "查询关键字"
            },
            ver: {
                field: "ver",
                type: DataTypes.STRING(50),
                allowNull: false,
                comment: "文件版本"
            },
            // 视图类型  TABLE TREE  EDIT  SHOW  CUSTOM
            configType: {
                field: "config_type",
                type: DataTypes.STRING(50),
                allowNull: false,
                comment: "视图类型"
               
            },
            content: {
                field: "content",
                type: DataTypes.TEXT,
                allowNull: false,
                comment: "文件内容",
            },
            renderClass: {
                field: "render_class",
                type: DataTypes.STRING(500),
                allowNull: true,
                comment: "渲染引擎",  
            },
            parameterString: {
                field: "parameter_string",
                type: DataTypes.STRING(200),
                allowNull: true,
                comment: "参数列表",
            },
            viewName: {
                field: "view_name",
                type: DataTypes.STRING(200),
                allowNull: true,
                comment: "视图描述",
            },
            systemFlag: {
                field: "system_flag",
                type: DataTypes.BIGINT(11),
                allowNull: true,
                comment: "是否系统字段",
            },
            ...Base.getAttr(sequelize, DataTypes)
            
            
        };
        return attributes;
    };
    const sysModelView = sequelize.define('sysModelView', getAttributes(sequelize, DataTypes), {
        freezeTableName: true,
        tableName: "sys_model_view",
        timestamps: false
    });
    
    // sysModelView.getHasMany = function(){
    //     return ["sysModelAttrs"];
    // };
    Base.extendModel(sysModelView, getAttributes(sequelize, DataTypes));
    return sysModelView;
};